#pragma once

#include <windows.h>
#include <string>

enum class DesktopType {
    NORMAL = 0,
    SECURE = 1,
    WINLOGON = 2,
    SCREENSAVER = 3,
    UAC = 4,
    UNKNOWN = 5
};

class DesktopMonitor {
public:
    DesktopMonitor();
    ~DesktopMonitor();

    bool Initialize();
    void Cleanup();
    bool HasDesktopChanged();
    DesktopType GetCurrentDesktopType();
    HDESK GetCurrentDesktop();
    std::string GetDesktopName();
    std::string GetLastError() const { return m_lastError; }

private:
    bool SwitchToDesktop(HDESK hDesktop);
    DesktopType DetermineDesktopType(const std::string& desktopName);

private:
    std::string m_lastError;
    HDESK m_currentDesktop;
    std::string m_currentDesktopName;
    DesktopType m_currentDesktopType;
    DWORD m_lastSessionId;
};